<!DOCTYPE html>
<html lang="ch">
<head>
    <meta charset="UTF-8">
    <script type="application/javascript" src="/static/js/common.js"></script>
    <title>返款信息</title>
</head>
<body>
<div class="app-panel">
    <div class="app-form">
        <form class="layui-form" action="" lay-filter="_form_filter">
            <div class="layui-form-item">
                <label class="layui-form-label">返款单价</label>
                <div class="layui-input-inline">
                    <input type="number" min="0.00" step="0.01" name="returnPrice" autocomplete="off" class="layui-input" id="product_returnPrice">
                </div>
                <div class="layui-form-mid layui-word-aux">来源产品维护信息</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">返款总额</label>
                <div class="layui-input-inline">
                    <input type="number" min="0.00" step="0.01" name="returnTotalPrice" autocomplete="off" class="layui-input" id="product_returnTotalPrice">
                </div>
                <div class="layui-form-mid layui-word-aux">根据订单采购数量自动计算</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">实返金额</label>
                <div class="layui-input-inline">
                    <input type="number" min="0.00" step="0.01" name="actualPrice" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">返款单位或返款人</label>
                <div class="layui-input-block">
                    <textarea name="refundPeople" autocomplete="on" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">返款时间</label>
                <div class="layui-input-block">
                    <input type="text" name="returnTime" class="layui-input" id="_returnTime">
                </div>
            </div>
        </form>
    </div>
</div>
<script type="application/javascript">
    layui.use(['form', 'utils', 'axiosUtil', 'laydate'], function () {
        var $ = layui.jquery,
            utils = layui.utils,
            form = layui.form,
            laydate = layui.laydate,
            axiosUtil = layui.axiosUtil;

        var id = utils.requestParam("id"),
            product_uuid = utils.requestParam("product_uuid");

        //执行一个laydate实例
        laydate.render({
            elem: '#_returnTime', //指定元素
            type: 'datetime',
            format: 'yyyy-MM-dd HH:mm',
            value : utils.nowTime()
        });

        //获取bill详情
        axiosUtil.axios_get("/productBill/info", {id: id}, function (data) {
            form.val("_form_filter", data);
            axiosUtil.axios_get("/product/info", {uuid: product_uuid}, function (product) {
                $("#product_returnPrice").val(product.returnPrice);
                //计算返款总额
                $("#product_returnTotalPrice").val(product.returnPrice * data.number);
            });
        });


    })
</script>
</body>
</html>
